<title>Detail penilaian pegawai</title>
<?
// detail penilaian LP2
include("config.php");
$nik		= $HTTP_GET_VARS['nik'];
$periode 	= $HTTP_GET_VARS['periode'];

$s1			= mssql_query("SELECT B.*,A.Nama FROM Karyawan A, S_LP B WHERE A.NIK=B.NIK AND A.NIK='$nik' AND B.periode='$periode'",$conn);
$r1			= mssql_fetch_array($s1);

// get data from karir ptsi
$skarptsi = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='$nik'",$conn);
$rkarptsi = mssql_fetch_array($skarptsi);

$scb = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rkarptsi[kode_so2],0,7)."'",$conn);
$rcb = mssql_fetch_array($scb);	

?>
<link rel="stylesheet" type="text/css" href="../style/style.css">
<table width="100%">
 <tr>
  <td style="font-size:12px; border-bottom:solid 1px #000000;"><b>Detail Penilai:</b></td>
 </tr>
 <tr>
  <td>
   <table border="0" width="100%">
 <tr class="contentlist">
  <td width="">NIK:</td>
  <td width=""><?=$r1[NIK]?></td>
  <td width="20">&nbsp;</td>
  <td>Biro/Cabang/Divisi:</td>
  <td><?=$rcb[uraian]?></td>  
 </tr>
 <tr class="contentlist">
  <td>Nama:</td>
  <td><?=$r1[Nama]?></td>
  <td width="20">&nbsp;</td>
  <td>Jabatan:</td>
  <td>
  <?
  	if(!empty($rkarptsi[jabatan2])){
		$jab 	= $rkarptsi[jabatan2];
		if(empty($jab)){
		}
		else{
			$sjab 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='$jab'");
			if(mssql_num_rows($sjab) > 0){
				$rjab = mssql_fetch_array($sjab);
				echo"$rjab[jabatan]";
			}
		}
	}
  ?>
  </td>  
 </tr>
 <tr class="contentlist">
  <td>Periode:</td>
  <td colspan="5"><?=$r1[periode]?></td>
 </tr>
   </table>
  </td>
 </tr>
 <tr>
  <td>
   <fieldset>
    <legend>Penilai</legend>
    <table width="100%">
     <tr>
      <td><b>Penilai Atasan</b>:</td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI I
      	$A = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_atasan1]."'",$conn);
		$rA = mssql_fetch_array($A);
		// get divisi
		$scbA = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rA[kode_so2],0,7)."'",$conn);
		$rcbA = mssql_fetch_array($scbA);	
		// get jabatan
		$sjabA 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rA[jabatan2]."'");
		$rjabA = mssql_fetch_array($sjabA);	
		// get status 
		$sgp	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_atasan1]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgp) > 0){
			$rstatus= mssql_fetch_array($sgp);
			$status = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus[tanggal]</a>";
		}
		else{
			$status = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      1. <?=$rA[Nama]?> <i>(<?=$rA[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbA[uraian]?>, <i>Jabatan</i>: <?=$rjabA[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$status?></i>
      </td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI II
      	$B = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_atasan2]."'",$conn);
		$rB = mssql_fetch_array($B);
		// get divisi
		$scbB = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rB[kode_so2],0,7)."'",$conn);
		$rcbB = mssql_fetch_array($scbB);	
		// get jabatan
		$sjabB 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rB[jabatan2]."'");
		$rjabB = mssql_fetch_array($sjabB);	
		// get status 
		$sgp2	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_atasan2]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgp2) > 0){
			$rstatus2= mssql_fetch_array($sgp2);
			$status2 = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus2[tanggal]</a>";
		}
		else{
			$status2 = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      2. <?=$rB[Nama]?> <i>(<?=$rB[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbB[uraian]?>, <i>Jabatan</i>: <?=$rjabB[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$status2?></i>
      
      </td>
     </tr>
	<tr>
     <td>&nbsp;</td>
    </tr>
     <tr>
      <td><b>Penilai Peers (Rekan Kerja)</b>:</td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI PEERS I
      	$C = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_peers1]."'",$conn);
		$rC = mssql_fetch_array($C);
		// get divisi
		$scbC = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rC[kode_so2],0,7)."'",$conn);
		$rcbC = mssql_fetch_array($scbC);	
		// get jabatan
		$sjabC 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rC[jabatan2]."'");
		$rjabC = mssql_fetch_array($sjabC);	
		// get status 
		$sgp3	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_peers1]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgp3) > 0){
			$rstatus3= mssql_fetch_array($sgp3);
			$status3 = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus3[tanggal]</a>";
		}
		else{
			$status3 = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      1. <?=$rC[Nama]?> <i>(<?=$rC[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbC[uraian]?>, <i>Jabatan</i>: <?=$rjabC[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$status3?></i>
      
      </td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI PEERS II
      	$D = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_peers2]."'",$conn);
		$rD = mssql_fetch_array($D);
		// get divisi
		$scbD = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rD[kode_so2],0,7)."'",$conn);
		$rcbD = mssql_fetch_array($scbD);	
		// get jabatan
		$sjabD 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rD[jabatan2]."'");
		$rjabD = mssql_fetch_array($sjabD);	
		// get status 
		$sgp4	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_peers2]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgp4) > 0){
			$rstatus4= mssql_fetch_array($sgp4);
			$status4 = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus4[tanggal]</a>";
		}
		else{
			$status4 = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      2. <?=$rD[Nama]?> <i>(<?=$rD[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbD[uraian]?>, <i>Jabatan</i>: <?=$rjabD[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$status4?></i>      
      </td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI PEERS III
      	$E = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_peers3]."'",$conn);
		$rE = mssql_fetch_array($E);
		// get divisi
		$scbE = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rE[kode_so2],0,7)."'",$conn);
		$rcbE = mssql_fetch_array($scbE);	
		// get jabatan
		$sjabE 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rE[jabatan2]."'");
		$rjabE = mssql_fetch_array($sjabE);	
		// get status 
		$sgp5	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_peers3]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgp5) > 0){
			$rstatus5= mssql_fetch_array($sgp5);
			$status5 = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus5[tanggal]</a>";
		}
		else{
			$status5 = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      3. <?=$rE[Nama]?> <i>(<?=$rE[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbE[uraian]?>, <i>Jabatan</i>: <?=$rjabE[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$status5?></i>      
      </td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <?
	  if(empty($r1[penilai_adum])){
	  	return false;
	  }
	 ?>
     <tr>
      <td><b>Penilai Administrasi Umum (Kepegawaian)</b>:</td>
     </tr>
     <tr>
      <td>
      <?
	  // get nik, nama PENILAI ADUM	  
      	$F = mssql_query("SELECT * FROM VLatestKarir WHERE NIK='".$r1[penilai_adum]."'",$conn);
		$rF = mssql_fetch_array($F);
		// get divisi
		$scbF = mssql_query("SELECT uraian FROM VLevelCabang WHERE substring(kode_so,1,7)='".substr($rF[kode_so2],0,7)."'",$conn);
		$rcbF = mssql_fetch_array($scbF);	
		// get jabatan
		$sjabF 	= mssql_query("SELECT * FROM MstJabatan WHERE kode='".$rF[jabatan2]."'");
		$rjabF = mssql_fetch_array($sjabF);	
		// get status 
		$sgpF	= mssql_query("SELECT *, convert(char(12), created, 103) tanggal FROM S_LP_Detail WHERE NIK = '$nik' AND nama_penilai = '$r1[penilai_adum]' AND periode = '$periode'",$conn);
		if(mssql_num_rows($sgpF) > 0){
			$rstatusF= mssql_fetch_array($sgpF);
			$statusF = "<span style='color: green;'>Sudah menilai pada tanggal $rstatus[tanggal]</a>";
		}
		else{
			$statusF = "<span style='color: red;'>Belum menilai</a>";
		}
	  ?>
      1. <?=$rF[Nama]?> <i>(<?=$rF[NIK]?>)</i><br>
	  &nbsp;&nbsp;&nbsp;&nbsp; <i>Divisi</i>: <?=$rcbF[uraian]?>, <i>Jabatan</i>: <?=$rjabF[jabatan]?>
      <br />&nbsp;&nbsp;&nbsp;&nbsp; <i>Status: <?=$statusF?></i>
      </td>
     </tr>
    </table>
   </fieldset>
  </td>
 </tr>
 <tr>
  <td align="right"><input type="button" value="Tutup" class="button" onClick="Javascript:window.close();"></td>
 </tr>
</table>